package com.example.siyun.service.impl.permissionsserviceimpl;

import com.example.siyun.mapper.permissionsmapper.BackofficeMapper;
import com.example.siyun.pojo.BackofficeTable;
import com.example.siyun.pojo.BackOfficeTree;
import com.example.siyun.service.permissionsservice.BackofficeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * @Auther: 全
 * @Date: 2022/9/26 09:33
 * @Description:权限管理模块后台管理人员列表
 */
@Service
public class BackofficeServiceImpl implements BackofficeService {
    @Autowired
    private BackofficeMapper backofficeMapper;
    /**
     * 获取后台管理人员列表的数据
     * @return 返回台管理人员列表的数据
     */
    @Transactional
    @Override
    public List<BackOfficeTree> getBackOfficeTree() {
        return backofficeMapper.getBackOfficeTree();
    }
    /**
     * 获取后台管理人员列表的数据
     * @return 返回台管理人员列表的数据
     */
    @Transactional
    @Override
    public List<BackofficeTable> getBackOfficeTable(BackofficeTable backofficetable,int isdel) {
        return backofficeMapper.getBackOfficeTable(backofficetable,isdel);
    }
    /**
     * 获取后台管理人员列表的数据通过id
     * @return id要获取的后台管理人员的id
     */
    @Transactional
    @Override
    public BackofficeTable getBackOfficeTableById(int id) {
        return backofficeMapper.getBackOfficeTableById(id);
    }
    @Transactional
    @Override
    public void setPermissions(BackofficeTable backofficetable) {
        backofficeMapper.setPermissions(backofficetable);
    }
    @Transactional
    @Override
    public void setPermissionsTable(BackofficeTable backofficetable) {
        backofficeMapper.setPermissionsTable(backofficetable);
    }
    /**
     * 修改账号状态通过id
     * param id要修改的账号的id,state要修改为的状态
     */
    @Transactional
    @Override
    public void updateState(int id, int state) {
        backofficeMapper.updateState(id,state);
    }
    @Transactional
    @Override
    public void resetAccount(int id,int bannum) {
        backofficeMapper.resetAccount(id,bannum);
    }
}
